home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / unix / include / sys / wait.h < prev   
C/C++ Source or Header  |  1992-08-14  |  3KB  |  83 lines

  1. /*
  2.  * Copyright (c) 1982, 1986, 1989 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)wait.h    7.17 (Berkeley) 6/19/91
  34.  */
  35.  
  36. /*
  37.  * This file holds definitions relevent to the wait4 system call
  38.  * and the alternate interfaces that use it (wait, wait3, waitpid).
  39.  */
  40.  
  41. /*
  42.  * Macros to test the exit status returned by wait
  43.  * and extract the relevant values.
  44.  */
  45. #define    _W_INT(i)    (i)
  46.  
  47. #define    _WSTATUS(x)    (_W_INT(x) & 0177)
  48. #define    _WSTOPPED    0177        /* _WSTATUS if process is stopped */
  49. #define WIFSTOPPED(x)    (_WSTATUS(x) == _WSTOPPED)
  50. #define WSTOPSIG(x)    (_W_INT(x) >> 8)
  51. #define WIFSIGNALED(x)    (_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0)
  52. #define WTERMSIG(x)    (_WSTATUS(x))
  53. #define WIFEXITED(x)    (_WSTATUS(x) == 0)
  54. #define WEXITSTATUS(x)    (_W_INT(x) >> 8)
  55. #define    W_EXITCODE(ret, sig)    ((ret) << 8 | (sig))
  56. #define    W_STOPCODE(sig)        ((sig) << 8 | _WSTOPPED)
  57.  
  58. /*
  59.  * Option bits for the second argument of wait4.  WNOHANG causes the
  60.  * wait to not hang if there are no stopped or terminated processes, rather
  61.  * returning an error indication in this case (pid==0).  WUNTRACED
  62.  * indicates that the caller should receive status about untraced children
  63.  * which stop due to signals.  If children are stopped and a wait without
  64.  * this option is done, it is as though they were still running... nothing
  65.  * about them is returned.
  66.  */
  67. #define WNOHANG        1    /* dont hang in wait */
  68. #define WUNTRACED    2    /* tell about stopped, untraced children */
  69.  
  70. #ifndef KERNEL
  71. #include <sys/types.h>
  72. #include <sys/cdefs.h>
  73.  
  74. __BEGIN_DECLS
  75. struct rusage;    /* forward declaration */
  76.  
  77. pid_t    wait __P((int *));
  78. pid_t    waitpid __P((pid_t, int *, int));
  79. pid_t    wait3 __P((int *, int, struct rusage *));
  80. pid_t    wait4 __P((pid_t, int *, int, struct rusage *));
  81. __END_DECLS
  82. #endif
  83.